import request from '@/utils/request'

// 分页查询所有优惠券
export function getAllCoupons(params) {
  return request({
    url: '/coupons',
    method: 'get',
    params: {
      page: params.page || 1,
      size: params.size || 10,
      keyword: params.keyword,
      category: params.category
    }
  })
}

// 分页查询平台券
export function getPlatformCoupons(params) {
  return request({
    url: '/coupons/platform',
    method: 'get',
    params: {
      page: params.page || 1,
      size: params.size || 10,
      status: params.status
    }
  })
}

// 领取优惠券
export function claimCoupon(couponId) {
  return request({
    url: `/coupons/${couponId}/claim`,
    method: 'post'
  })
}

// 获取优惠券详情
export function getCouponDetail(couponId) {
  return request({
    url: `/coupons/${couponId}`,
    method: 'get'
  })
}

// 获取优惠券历史记录
export function getCouponHistory(params) {
  return request({
    url: '/coupons/history',
    method: 'get',
    params: {
      page: params.page || 1,
      size: params.size || 10,
      status: params.status
    }
  })
} 